package Array;
import java.util.Scanner;
public class S06 {
	//显示n个学生的成绩与平均成绩的差值
	public static void main(String[] args) {
		System.out.println("请输入学生的人数：");
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt(); //学生的人数
		int[] g = new int[n];
		int sum = 0; //成绩和
		System.out.println("请输入学生成绩：");
		for (int i = 0; i < n; ++i) {
			g[i] = sc.nextInt();
			sum += g[i];
		}
		double pj = (double) sum / g.length;
		System.out.printf("平均成绩=%.1f\n", pj);
		System.out.println("成绩\t与平均成绩的差值");
		for (int i = 0; i < n; ++i) {
			System.out.printf("%d\t%5.1f\n", g[i], g[i] - pj);
		}
	}
}
